from PySide6.QtWidgets import QWidget, QPushButton, QLabel, QComboBox,QHBoxLayout, QVBoxLayout, QGraphicsOpacityEffect, QGraphicsDropShadowEffect
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale, Signal,
    QMetaObject, QObject, QPoint, QRect,
    QSize, QTime, QUrl, Qt)
from PySide6.QtGui import QBrush, QColor, QConicalGradient, QCursor, QPixmap, QMouseEvent
# from yolov5 import detect
def detect(a):
    pass

class My_chechang(QWidget):
    def __init__(self, *args, **kwargs):
        super(My_chechang, self).__init__(*args, **kwargs)
        self.setupUI()

    def setupUI(self):
        self.container = QWidget(self)
        self.container.setFixedWidth(171)
        self.container.setStyleSheet(u"background-color: rgb(79, 91, 103);\n""border: none;")

        self.cwzt = QPushButton("车位状态显示")
        # self.cwxx = QPushButton("车位信息管理")
        self.cwzt.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
        # self.cwxx.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font: 11pt;\n""border: none;")
        self.layout = QVBoxLayout(self)
        self.layout.addWidget(self.cwzt)
        # self.layout.addWidget(self.cwxx)
        self.layout.setSpacing(5)
        self.layout.setContentsMargins(0,5,0,5)
        self.container.setLayout(self.layout)
        self.cwzt.clicked.connect(self.but1)
        # self.cwxx.clicked.connect(self.but2)

    def but1(self):
        self.cwzt.setStyleSheet(u"color: rgb(28, 158, 164);\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
        # self.cwxx.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font: 11pt;\n""border: none;")
    
    # def but2(self):
    #     self.cwxx.setStyleSheet(u"color: rgb(28, 158, 164);\n""background-color: rgb(79, 91, 103);\n""font: 11pt;\n""border: none;")
    #     self.cwzt.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font: 11pt;\n""border: none;")
    #     detect(type="cwxx")

class My_cheguan(QWidget):
    def __init__(self, *args, **kwargs):
        super(My_cheguan, self).__init__(*args, **kwargs)
        self.setupUI()

    def setupUI(self):
        self.container = QWidget(self)
        self.container.setFixedWidth(171)
        self.container.setStyleSheet(u"background-color: rgb(79, 91, 103);\n""border: none;")
        # 违规泊车
        self.wgbcLbl = QPushButton("违规泊车案例抓拍查询")
        # 白名单
        self.bmdLbl = QPushButton("停车白名单评估与统计")
        self.wgbcLbl.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
        self.bmdLbl.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
        # self.TextLbl.setText("全景")
        self.layout = QVBoxLayout(self)
        self.layout.addWidget(self.wgbcLbl)
        self.layout.addWidget(self.bmdLbl)
        self.layout.setSpacing(15)
        # self.layout.setContentsMargins(0,0,0,0)
        # self.setLayout(self.layout)
        self.container.setLayout(self.layout)
        self.wgbcLbl.clicked.connect(self.but1)
        self.bmdLbl.clicked.connect(self.but2)

    def but1(self):
        self.wgbcLbl.setStyleSheet(u"color: rgb(28, 158, 164);\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
        self.bmdLbl.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
        detect(type="wgbc")

    def but2(self):
        self.bmdLbl.setStyleSheet(u"color: rgb(28, 158, 164);\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
        self.wgbcLbl.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
        detect(type="bmd")

# 全息三级按钮
class My_pushbut_qx(QWidget):
    def __init__(self, *args, **kwargs):
        super(My_pushbut_qx, self).__init__(*args, **kwargs)
        self.setupUI()

    def setupUI(self):
        self.container = QWidget(self)
        self.container.setFixedSize(171, 24)
        self.container.setStyleSheet(u"background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: None;")
        # self.but1 = QPushButton("车位利用")
        # self.but1.setStyleSheet(u"color: white;\n"
        #                          "background-color: rgb(79, 91, 103);\n"
        #                          "border: none;")
        # self.but1.setCursor(QCursor(Qt.PointingHandCursor))
        self.but2 = QPushButton("财务营收")
        self.but2.setStyleSheet(u"color: white;\n"
                                 "background-color: rgb(79, 91, 103);\n"
                                 "border: none;")
        self.but2.setCursor(QCursor(Qt.PointingHandCursor))
        self.layout = QVBoxLayout(self)
        # self.layout.addWidget(self.but1)
        self.layout.addWidget(self.but2)
        self.layout.setContentsMargins(0,2,0,2)
        # self.layout.setSpacing(0)
        self.container.setLayout(self.layout)
        # self.but1.clicked.connect(self.push1)
        self.but2.clicked.connect(self.push2)

    # def push1(self):
    #     self.but1.setStyleSheet(u"color: rgb(28, 158, 164);\n""background-color: rgb(79, 91, 103);\n""border: none;")
    #     self.but2.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
    #     detect("cwly")
        
    def push2(self):
        self.but2.setStyleSheet(u"color: rgb(28, 158, 164);\n""background-color: rgb(79, 91, 103);\n""border: none;")
        # self.but1.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
        detect("cwsr")


# 全景三级按钮
class My_pushbut_qj(QWidget):
    def __init__(self, *args, **kwargs):
        super(My_pushbut_qj, self).__init__(*args, **kwargs)
        self.setupUI()
    
    def setupUI(self):
        self.container = QWidget(self)
        self.container.setFixedSize(171, 24)
        self.container.setStyleSheet(u"background-color: rgb(79, 91, 103);\n""border: none;")
        self.list = []
        self.but1 = QPushButton("可用泊车位显示")
        self.but1.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
        self.but1.setCursor(QCursor(Qt.PointingHandCursor))
        self.list.append(self.but1)
        # self.but2 = QPushButton("泊位周转率")
        # self.but2.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
        # self.but2.setCursor(QCursor(Qt.PointingHandCursor))
        # self.list.append(self.but2)
        # self.but3 = QPushButton("跨日停车位")
        # self.but3.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
        # self.but3.setCursor(QCursor(Qt.PointingHandCursor))
        # self.list.append(self.but3)
        # self.but4 = QPushButton("特殊车辆停放管理")
        # self.but4.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
        # self.but4.setCursor(QCursor(Qt.PointingHandCursor))
        # self.list.append(self.but4)
        
        self.layout = QVBoxLayout(self)
        for i in self.list:
            self.layout.addWidget(i)
        self.layout.setContentsMargins(0,0,0,0)
        self.container.setLayout(self.layout)
        # self.setLayout(self.layout)

        self.but1.clicked.connect(self.push1)
        # self.but2.clicked.connect(self.push2)
        # self.but3.clicked.connect(self.push3)
        # self.but4.clicked.connect(self.push4)

    def push1(self):
        self.but1.setStyleSheet(u"color: rgb(28, 158, 164);\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
        # self.but2.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
        # self.but3.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
        # self.but4.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
        detect("bcw")
        
    # def push2(self):
    #     self.but2.setStyleSheet(u"color: rgb(28, 158, 164);\n""background-color: rgb(79, 91, 103);\n""border: none;")
    #     self.but1.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
    #     self.but3.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
    #     self.but4.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
    #     detect("zzl")
    
    # def push3(self):
    #     self.but3.setStyleSheet(u"color: rgb(28, 158, 164);\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
    #     self.but1.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
        # self.but2.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
        # self.but4.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
        # detect("kr")

    # def push4(self):
    #     self.but4.setStyleSheet(u"color: rgb(28, 158, 164);\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
    #     self.but1.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
        # self.but2.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
        # self.but3.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
        # detect("tscl")

        

# 小菜单选择按键
class My_pushbut_s(QPushButton):
    def __init__(self, *args, **kwargs):
        super(My_pushbut_s, self).__init__(*args, **kwargs)
        self.setupUI()

    def setupUI(self):
        # TODO
        self.setStyleSheet(u"background-color: rgb(79, 91, 103);\n""border: None;\n")
        self.setFixedSize(171, 26)
        # self.container = QWidget(self)
        # self.container.setFixedWidth(171)
        self.ImgLbl = QLabel(self)
        self.TextLbl = QLabel(self)
        self.ImgLbl.setFixedSize(12, 12)
        self.TextLbl.setFixedSize(100, 24)
        # self.container.setStyleSheet(u"background-color: rgb(79, 91, 103);\n")
        self.TextLbl.setStyleSheet(u"color: white;\n" 
"font: 11pt;\n")
        # self.TextLbl.setText("全景")
        self.ImgLbl.setStyleSheet(u"image: url(:/image/img/smallleft.png);\n")
        self.layout = QHBoxLayout(self)
        self.layout.addWidget(self.TextLbl)
        self.layout.addWidget(self.ImgLbl)
        self.layout.setSpacing(20)
        self.layout.setContentsMargins(0,0,0,0)
        self.setLayout(self.layout)
        # self.container.setLayout(self.layout)

# 全景子列表
class My_list_s(QWidget):
    def __init__(self, *args, **kwargs):
        super(My_list_s, self).__init__(*args, **kwargs)
        self.setupUI()

    def setupUI(self):
        self.container = QWidget(self)
        # self.container.setStyleSheet(u"background-color: rgb(79, 91, 103)\n")
        # self.container.setStyleSheet(u"border: None\n")
        # self.container.setFixedSize(171, 100)
        self.container.setFixedWidth(171)
        self.Mysmall1 = My_pushbut_s(self.container)
        self.Mysmall1.setStyleSheet(u"border: None\n")
        self.Mysmall1.TextLbl.setText("全景")
        self.Mysmall2 = My_pushbut_s(self.container)
        self.Mysmall2.TextLbl.setText("全息")
        self.Mysmall1.setCursor(QCursor(Qt.PointingHandCursor))
        self.Mysmall2.setCursor(QCursor(Qt.PointingHandCursor))
        self.layout = QVBoxLayout(self.container)
        self.layout.addWidget(self.Mysmall1)
        self.layout.addWidget(self.Mysmall2)
        # self.layout.setSpacing(0)
        # self.layout.setContentsMargins(0,0,0,0)
        self.container.setLayout(self.layout)
        self.Mysmall1.clicked.connect(self.but1)
        self.Mysmall2.clicked.connect(self.but2)
        self.count1 = True
        self.count2 = True
        self.Mywig1 = My_pushbut_qj(self)
        self.Mywig1.setFixedHeight(100)
        self.Mywig1.setVisible(False)

    def but1(self):
        if self.count1:
            self.Mywig1.but1.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
            self.Mywig1.but2.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
            self.Mywig1.but3.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
            self.Mywig1.but4.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
            self.Mywig1.setVisible(True)
            self.Mysmall1.ImgLbl.setStyleSheet(u"image: url(:/image/img/smalldown.png);\n"
"border: None;")
            # self.MypushButton1.setFixedSize(170, 71)
            # self.MypushButton1.TextLbl.setFixedSize(15, 32)
            self.count1 = False
        else:
            self.Mysmall1.ImgLbl.setStyleSheet(u"image: url(:/image/img/smallleft.png);\n"
"border: None;")
            self.count1 = True

    def but2(self):
        if self.count2:
            self.Mywig1.setVisible(True)
            self.Mysmall2.ImgLbl.setStyleSheet(u"image: url(:/image/img/smalldown.png);\n"
    "border: None;")
            # self.MypushButton1.setFixedSize(170, 71)
            # self.MypushButton1.TextLbl.setFixedSize(15, 32)
            self.count2 = False
        else:
            self.Mysmall2.ImgLbl.setStyleSheet(u"image: url(:/image/img/smallleft.png);\n"
    "border: None;")
            self.count2 = True

# 菜单选择按键
class My_pushbut(QPushButton):
    def __init__(self, *args, **kwargs):
        super(My_pushbut, self).__init__(*args, **kwargs)
        self.ImgLbl = QLabel()
        self.TextLbl = QLabel()
        # self.setStyleSheet(u"background-color: transparent\n")
        # ubuntu下显示不一致
        self.setStyleSheet(u"border: None;\n")
        self.ImgLbl.setFixedSize(135, 42)
        self.ImgLbl.setStyleSheet(u"image: url(:/image/img/jiankong.png);\n"
"border: None;\n")
        self.TextLbl.setFixedSize(32, 15)
        self.TextLbl.setStyleSheet(u"image: url(:/image/img/leftarrow.png);\n"
"border: None;")
        self.mainLayout = QHBoxLayout()
        self.mainLayout.addWidget(self.ImgLbl)
        self.mainLayout.addWidget(self.TextLbl)
        self.mainLayout.setSpacing(0)
        self.setLayout(self.mainLayout)

# 菜单选择列表
class My_list(QWidget):
    def __init__(self, *args, **kwargs):
        super(My_list, self).__init__(*args, **kwargs)
        self.setupUI()
        # self.setWindowFlag(Qt.Window)

    def setupUI(self):
        self.MypushButton1 = My_pushbut(self)
        self.MypushButton1.setObjectName(u"MypushButton1")
        # self.MypushButton1.setGeometry(QRect(30, 70, 180, 61))
        self.MypushButton1.setFixedSize(175, 70)
        self.MypushButton1.ImgLbl.setStyleSheet(u"image: url(:/image/img/jiankong.png);\n"
"border: None;\n")
        self.MypushButton1.setCursor(QCursor(Qt.PointingHandCursor))
        # self.MypushButton1.setStyleSheet(u"#My_pushbut: hover{background-color:rgba(250,50,50,0.4)}")

        self.MypushButton2 = My_pushbut(self)
        self.MypushButton2.setFixedSize(175, 70)
        self.MypushButton2.setObjectName(u"MypushButton2")
        # self.MypushButton2.setGeometry(QRect(30, 140, 180, 61))
        self.MypushButton2.ImgLbl.setStyleSheet(u"image: url(:/image/img/chechang.png);\n"
"border: None;\n")
        self.MypushButton2.setCursor(QCursor(Qt.PointingHandCursor))

        # self.MypushButton3 = My_pushbut(self)
        # self.MypushButton3.setObjectName(u"MypushButton3")
        # self.MypushButton3.ImgLbl.setFixedSize(130, 45)
        # self.MypushButton3.setFixedSize(175, 70)
        # self.MypushButton3.setGeometry(QRect(30, 210, 180, 61))
        # self.MypushButton3.ImgLbl.setStyleSheet(u"image: url(:/image/img/cheguan.png);\n"
# "border: None;\n")
        # self.MypushButton3.setCursor(QCursor(Qt.PointingHandCursor))
        # 全景按钮
        self.Mywig1 = My_pushbut_s(self)
        self.Mywig1.TextLbl.setText("全景")
        self.Mywig1.setCursor(QCursor(Qt.PointingHandCursor))
        self.Mywig1.setVisible(False)
        # 全景子功能
        self.Mywig1_s = My_pushbut_qj(self)
        self.Mywig1_s.setFixedSize(171, 24)
        self.Mywig1_s.setVisible(False)
        # 全息按钮
        # self.Mywig2 = My_pushbut_s(self)
        # self.Mywig2.TextLbl.setText("全息")
        # self.Mywig2.setCursor(QCursor(Qt.PointingHandCursor))
        # self.Mywig2.setVisible(False)
        # 全息子功能
        # self.Mywig2_s = My_pushbut_qx(self)
        # self.Mywig2_s.setFixedSize(171, 24)
        # self.Mywig2_s.setVisible(False)

        self.Mywig3 = My_chechang(self)
        self.Mywig3.setCursor(QCursor(Qt.PointingHandCursor))
        self.Mywig3.setFixedHeight(30)
        self.Mywig3.setVisible(False)
        
        # self.Mywig4 = My_cheguan(self)
        # self.Mywig4.setCursor(QCursor(Qt.PointingHandCursor))
        # self.Mywig4.setFixedHeight(80)
        # self.Mywig4.setVisible(False)
        # self.Mywig3.setStyleSheet(u"background-color: rgb(79, 91, 103)\n")

        self.vboxlayout = QVBoxLayout(self)
        self.vboxlayout.addWidget(self.MypushButton1)
        self.vboxlayout.addWidget(self.Mywig1)
        self.vboxlayout.addWidget(self.Mywig1_s)
        # self.vboxlayout.addWidget(self.Mywig2)
        # self.vboxlayout.addWidget(self.Mywig2_s)
        self.vboxlayout.addWidget(self.MypushButton2)
        self.vboxlayout.addWidget(self.Mywig3)
        # self.vboxlayout.addWidget(self.MypushButton3)
        # self.vboxlayout.addWidget(self.Mywig4)
        # self.vboxlayout.addWidget(self.Mywig3)
        self.vboxlayout.addStretch()
        self.vboxlayout.setSpacing(0)
        self.vboxlayout.setContentsMargins(0,0,0,0)
        self.setLayout(self.vboxlayout)
        self.MypushButton1.clicked.connect(self.but1)
        self.MypushButton2.clicked.connect(self.but2)
        # self.MypushButton3.clicked.connect(self.but3)
        self.Mywig1.clicked.connect(self.but11)
        # self.Mywig2.clicked.connect(self.but12)
        self.count1 = True
        self.count11 = True
        self.count12 = True
        self.count2 = True
        self.count3 = True
    # 展开、收缩列表
    def but1(self):
        if self.count1:
            if self.Mywig3.isVisible(): # and self.Mywig4.isVisible():
                self.but2()
                # self.but3()
            # elif self.Mywig3.isVisible(): #  and not self.Mywig4.isVisible():
            #     self.but2()
            # elif not self.Mywig3.isVisible(): # and self.Mywig4.isVisible():
            #     self.but3()
            self.Mywig1.setVisible(True)
            # self.Mywig2.setVisible(True)
            self.Mywig1.ImgLbl.setStyleSheet(u"image: url(:/image/img/smallleft.png);\n")
            # self.Mywig2.ImgLbl.setStyleSheet(u"image: url(:/image/img/smallleft.png);\n")
            self.Mywig1_s.setVisible(False)
            # self.Mywig2_s.setVisible(False)
            self.Mywig1_s.but1.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
            # self.Mywig1_s.but2.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
            # self.Mywig1_s.but3.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
            # self.Mywig1_s.but4.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
            # self.Mywig2_s.but1.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
            # self.Mywig2_s.but2.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
            self.MypushButton1.TextLbl.setStyleSheet(u"image: url(:/image/img/downarrow.png);\n"
"border: None;")
            self.MypushButton1.setFixedSize(170, 71)
            self.MypushButton1.TextLbl.setFixedSize(15, 32)
            self.count1 = False
        else:
            self.Mywig1.setVisible(False)
            # self.Mywig2.setVisible(False)
            self.Mywig1_s.setVisible(False)
            # self.Mywig2_s.setVisible(False)
            self.MypushButton1.TextLbl.setStyleSheet(u"image: url(:/image/img/leftarrow.png);\n"
"border: None;")
            self.MypushButton1.setFixedSize(175, 71)
            self.MypushButton1.TextLbl.setFixedSize(32, 15)
            self.count1 = True

    def but2(self):
        if self.count2:
            if self.Mywig1.isVisible(): # and self.Mywig4.isVisible():
                self.but1()
                # self.but3()
            # elif self.Mywig1.isVisible(): # and not self.Mywig4.isVisible():
            #     self.but1()
            # elif not self.Mywig1.isVisible(): # and self.Mywig4.isVisible():
            #     self.but3()
            self.Mywig3.cwzt.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
            # self.Mywig3.cwxx.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font: 11pt;\n""border: none;")
            self.Mywig3.setVisible(True)
            self.MypushButton2.TextLbl.setStyleSheet(u"image: url(:/image/img/downarrow.png);\n"
"border: None;")
            self.MypushButton2.setFixedSize(170, 71)
            self.MypushButton2.TextLbl.setFixedSize(15, 32)
            self.count2 = False
        else:
            self.Mywig3.setVisible(False)
            self.MypushButton2.TextLbl.setStyleSheet(u"image: url(:/image/img/leftarrow.png);\n"
"border: None;")
            self.MypushButton2.setFixedSize(175, 71)
            self.MypushButton2.TextLbl.setFixedSize(32, 15)
            self.count2 = True

#     def but3(self):
#         if self.count3:
#             if self.Mywig1.isVisible() and self.Mywig3.isVisible():
#                 self.but1()
#                 self.but2()
#             elif self.Mywig1.isVisible() and not self.Mywig3.isVisible():
#                 self.but1()
#             elif not self.Mywig1.isVisible() and self.Mywig3.isVisible():
#                 self.but2()
#             self.Mywig4.bmdLbl.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
#             self.Mywig4.wgbcLbl.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""font-size: 11pt;\n""border: none;")
#             self.Mywig4.setVisible(True)
#             self.MypushButton3.TextLbl.setStyleSheet(u"image: url(:/image/img/downarrow.png);\n"
# "border: None;")
#             self.MypushButton3.setFixedSize(170, 71)
#             self.MypushButton3.TextLbl.setFixedSize(15, 32)
#             self.count3 = False
#         else:
#             self.Mywig4.setVisible(False)
#             self.MypushButton3.TextLbl.setStyleSheet(u"image: url(:/image/img/leftarrow.png);\n"
# "border: None;")
#             self.MypushButton3.setFixedSize(175, 71)
#             self.MypushButton3.TextLbl.setFixedSize(32, 15)
#             self.count3 = True

    def but11(self):
        if self.count11:
            self.Mywig1_s.setVisible(True)
            # self.Mywig2_s.setVisible(False)
            self.Mywig1_s.but1.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
            # self.Mywig1_s.but2.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
            # self.Mywig1_s.but3.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
            # self.Mywig1_s.but4.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
            self.Mywig1.ImgLbl.setStyleSheet(u"image: url(:/image/img/smalldown.png);\n")
            # self.Mywig2.ImgLbl.setStyleSheet(u"image: url(:/image/img/smallleft.png);\n")
            self.count12 = True
            self.count11 = False
        else:
            self.Mywig1_s.setVisible(False)
            self.Mywig1.ImgLbl.setStyleSheet(u"image: url(:/image/img/smallleft.png);\n")
            self.count11 = True

    def but12(self):    
        if self.count12:
            self.Mywig2_s.setVisible(True)
            # self.Mywig2_s.but1.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
            self.Mywig2_s.but2.setStyleSheet(u"color: white;\n""background-color: rgb(79, 91, 103);\n""border: none;")
            self.Mywig2.ImgLbl.setStyleSheet(u"image: url(:/image/img/smalldown.png);\n")
            self.count12 = False
            self.Mywig1_s.setVisible(False)
            self.Mywig1.ImgLbl.setStyleSheet(u"image: url(:/image/img/smallleft.png);\n")
            self.count11 = True
        else:
            self.Mywig2_s.setVisible(False)
            self.Mywig2.ImgLbl.setStyleSheet(u"image: url(:/image/img/smallleft.png);\n")
            self.count12 = True


# 单个状态列表
class My_title(QWidget):
    def __init__(self, *args, **kwargs):
        super(My_title, self).__init__(*args, **kwargs)
        self.setupUI()

    def setupUI(self):
        self.container = QWidget(self)
        self.container.setStyleSheet(u"background-color: rgb(28, 158, 164)\n")
        # self.container.setFixedSize(150, 30)
        # 设置阴影效果
        self.shadow = QGraphicsDropShadowEffect()
        self.shadow.setBlurRadius(10)
        self.shadow.setColor(Qt.black)
        self.shadow.setOffset(0)
        self.setGraphicsEffect(self.shadow)
        # 背景色设置
        # self.setStyleSheet(u"background-color: rgb(28, 158, 164)\n")
        # 添加控件
        self.TextLbl = QLabel(self)
        self.CloseLbl = QPushButton(self)
        self.CloseLbl.setCursor(QCursor(Qt.PointingHandCursor))
        
        # 图标设置
        self.CloseLbl.setStyleSheet(u"image: url(:/image/img/close.png);\n"
"border: None;")
        # self.setFixedSize(150, 30)
        self.CloseLbl.setFixedSize(10, 10)
        self.TextLbl.setFixedSize(100, 20)
        self.TextLbl.setStyleSheet(u"color: white;")
        self.TextLbl.setAlignment(Qt.AlignCenter)
        self.TextLbl.setText("可用泊车位显示")
        self.hboxlayout = QHBoxLayout(self)
        self.hboxlayout.addWidget(self.TextLbl)
        self.hboxlayout.addWidget(self.CloseLbl)
        self.hboxlayout.addStretch()
        self.hboxlayout.setSpacing(5)
        self.hboxlayout.setContentsMargins(5,0,5,0)
        self.container.setLayout(self.hboxlayout)
        

class My_state(QWidget):
    def __init__(self, *args, **kwargs):
        super(My_state, self).__init__(*args, **kwargs)
        self.container = QWidget(self)
        self.container.setStyleSheet(u"background-color: transparent;\n""border: none;")
        self.layout = QHBoxLayout(self)
        self.layout.addWidget

    def add_title(self, titletextname, titlename):
        self.titlename = My_title(self.container)
        self.titlename.TextLbl.setText(titletextname)
        self.layout.addWidget(self.titlename)

# 鼠标悬停事件 可用泊车显示
class hint(QWidget):
    def __init__(self, *args, **kwargs):
        super(hint, self).__init__(*args, **kwargs)
        self.setupUI()
        
    def setupUI(self):
        self.op = QGraphicsOpacityEffect()
        self.op.setOpacity(0.5)
        self.container = QWidget(self)
        self.container.setFixedSize(150, 100)
        self.container.setStyleSheet(u"background-color: rgb(32, 37, 42);\n""border: none;\n")
        self.container.setGraphicsEffect(self.op)
        self.label1 = QLabel(self.container)
        self.label2 = QLabel(self.container)
        self.label3 = QLabel(self.container)
        self.but = QPushButton(self.container)
        self.label1.setStyleSheet(u"color: white;\n""font-size: 8pt;\n""background-color: transparent;\n""border: none;\n")
        self.label2.setStyleSheet(u"color: white;\n""font-size: 8pt;\n""background-color: transparent;\n""border: none;\n")
        self.label3.setStyleSheet(u"color: white;\n""font-size: 8pt;\n""background-color: transparent;\n""border: none;\n")
        self.but.setStyleSheet(u"color: white;\n""font-size: 8pt;\n""background-color: transparent;\n""border: none;\n")
        self.but.setText("点击查看监控详情")
        self.but.setCursor(QCursor(Qt.PointingHandCursor))
        self.layout = QVBoxLayout(self)
        self.layout.addWidget(self.label1)
        self.layout.addWidget(self.label2)
        self.layout.addWidget(self.label3)
        self.layout.addWidget(self.but)
        
    

# 车位状态显示
class park_state(QWidget):
    def __init__(self, *args, **kwargs):
        super(park_state, self).__init__(*args, **kwargs)
        self.setupUI()
        
    def setupUI(self):
        self.setFixedSize(930, 520)
        self.park_show = QLabel(self)
        self.park_show.setGeometry(QRect(10, 10, 700, 490))
        self.park_show.setStyleSheet(u"background-color: rgb(255, 0, 0);")
        self.op = QGraphicsOpacityEffect()
        self.verticalLayoutWidget = QWidget(self)
        self.verticalLayoutWidget.setObjectName(u"verticalLayoutWidget")
        self.verticalLayoutWidget.setGeometry(QRect(729, 10, 191, 490))
        self.verticalLayout = QVBoxLayout(self.verticalLayoutWidget)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.chechang = QLabel(self.verticalLayoutWidget)
        self.chechang.setFixedHeight(30)
        self.chechang.setObjectName(u"chechang")
        self.chechang.setAlignment(Qt.AlignCenter)
        self.chechang.setText("车场信息")
        self.chechang.setStyleSheet(u"color: white;\n""background-color: rgb(28, 158, 164);\n""font-size: 13pt;\n")

        self.verticalLayout.addWidget(self.chechang)
        # 发布车位数
        self.fabu = QLabel(self.verticalLayoutWidget)
        self.fabu.setObjectName(u"fabu")
        self.fabu.setStyleSheet(u"color: white;\n""background-color: transparent;\n""font-size: 10pt;\n")
        self.fabu.setFixedHeight(25)

        self.verticalLayout.addWidget(self.fabu)
        # 使用车位数
        self.shiyong = QLabel(self.verticalLayoutWidget)
        self.shiyong.setObjectName(u"shiyong")
        self.shiyong.setStyleSheet(u"color: white;\n""background-color: transparent;\n""font-size: 10pt;\n")
        self.shiyong.setFixedHeight(25)

        self.verticalLayout.addWidget(self.shiyong)
        # 空闲车位数
        self.kongxian = QLabel(self.verticalLayoutWidget)
        self.kongxian.setObjectName(u"kongxian")
        self.kongxian.setStyleSheet(u"color: white;\n""background-color: transparent;\n""font-size: 10pt;\n")
        self.kongxian.setFixedHeight(25)

        self.verticalLayout.addWidget(self.kongxian)

        self.chewei = QLabel(self.verticalLayoutWidget)
        self.chewei.setObjectName(u"chewei")
        self.chewei.setFixedHeight(30)
        self.chewei.setAlignment(Qt.AlignCenter)
        self.chewei.setText("车位信息")
        self.chewei.setStyleSheet(u"color: white;\n""background-color: rgb(28, 158, 164);\n""font-size: 13pt;\n")

        self.verticalLayout.addWidget(self.chewei)

        self.horizontalLayout_3 = QHBoxLayout()
        self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
        self.xiangji = QLabel(self.verticalLayoutWidget)
        self.xiangji.setText("选择摄像机")
        self.xiangji.setStyleSheet(u"color: white;\n""background-color: transparent;\n""font-size: 10pt;\n")
        self.xiangji.setObjectName(u"xiangji")
        self.xiangji.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_3.addWidget(self.xiangji)

        self.comboBox = QComboBox(self.verticalLayoutWidget)
        self.comboBox.setFixedWidth(110)
        # 不同的相机编号,目前只支持一路
        self.comboBox.addItem("")
        self.comboBox.addItem("0")
        self.comboBox.setObjectName(u"comboBox")

        self.horizontalLayout_3.addWidget(self.comboBox)


        self.verticalLayout.addLayout(self.horizontalLayout_3)
        self.verticalLayout.addStretch()
        

        # self.cheweixinxi = QLabel(self.verticalLayoutWidget)
        # self.cheweixinxi.setObjectName(u"cheweixinxi")
        # self.cheweixinxi.setStyleSheet(u"color: white;\n""background-color: transparent;\n""font-size: 10pt;\n")
        # self.cheweixinxi.setText("车位信息")
        # self.cheweixinxi.setFixedHeight(15)

        # self.verticalLayout.addWidget(self.cheweixinxi)

        # self.message = QLabel(self.verticalLayoutWidget)
        # self.message.setObjectName(u"message")
        # self.message.setStyleSheet(u"background-color: white;\n""font-size: 10pt;\n")
        # self.message.setAlignment(Qt.AlignAbsolute)
        # self.message.setText(u"  车主姓名:\n""  车牌号码:\n")

        # self.verticalLayout.addWidget(self.message)
        # self.verticalLayout.setSpacing(20)
        
class park_avail(QLabel):
    possig = Signal(QPoint)
    
    def __init__(self, *args, **kwargs):
        super(park_avail, self).__init__(*args, **kwargs)
        
    def mousePressEvent(self, ev: QMouseEvent) -> None:
        self.possig.emit(ev.pos())
        # return super().mousePressEvent(ev)
        